<template>
  <div class="banner">
      <!-- 文章标题 -->
      <h1>{{news.title}}</h1>
      <!-- 文件发布时间 -->
      <p>
          <span>发布时间：{{news.add_time | comment()}}</span>
          <span>点击：{{news.click}}次</span>
      </p>
      <hr>
      <!-- 文章内容 -->
      <div v-html="news.content">

      </div>
      <comment :id="id"></comment>
  </div>
</template>
<script>
import comment from "../comment/comment";
export default {
  data() {
    return {
      id: this.$route.params.id,
      news: []
    };
  },
  created() {
    this.getNews();
  },
  methods: {
    getNews() {
      this.$http.get("api/getnew/" + this.id).then(results => {
        if (results.body.status == 0) {
          this.news = results.body.message[0];
        }
      });
    }
  },
  components: {
    comment
  }
};
</script>
<style lang="scss" scoped>
.banner {
  padding: 0 15px;
  background-color: #fff;
  h1 {
    font-size: 20px;
    text-align: center;
    padding: 15px 0;
  }
  p {
    display: flex;
    justify-content: space-between;
    color: red;
    font-size: 12px;
  }
}
[data-v-60824e2a] /deep/ img{
  width: 100%;
}
</style>
